﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyBBS.Data.Models;

namespace MyBBS.Data.Filters
{
    public static class PostFilter
    {
        public static IQueryable<Post> WithIDEquals(this IQueryable<Post> posts, long id)
        {
            return from p in posts
                   where p.ID == id
                   select p;
        }

        public static IQueryable<Post> WithAuthorEquals(this IQueryable<Post> posts, string author)
        {
            return (from post in posts
                    where post.Author == author
                    select post).AsQueryable<Post>();
        }

        public static IQueryable<Post> WithCategoryIDEquals(this IQueryable<Post> posts, long categoryID)
        {
            return (from post in posts
                    where post.CategoryID == categoryID
                    select post).AsQueryable<Post>();
        }

    }
}
